<?php
/*
 * Created on Nov 20, 2007
 * File: DoctrineImportClass.php
 * Project: BIMP
 * Author: jerrad
 */
 
  //require the includes php file one directory up
 require_once(dirname(dirname(__FILE__)). DIRECTORY_SEPARATOR ."includes.php");
 
function __autoload($class_name) {

      if($exists = !class_exists($class_name) && file_exists($class = CLASS_PATH.$class_name.'.class.php')){
        require_once $class;
        }
   	  elseif(!$exists) {
        eval('class '.$class_name.' extends Exception {}');
        throw new $class_name('[__autoload] this file doesn\'t exists: '.$class);
   	 }
}

	spl_autoload_register(array('Doctrine', 'autoload'));
	Doctrine_Manager::connection("mysql://bimp:bimp@localhost/bimp");
	
	// import method takes one parameter: the import directory (the directory where
	// the generated record files will be put in
	Doctrine::generateModelsFromDb('lib');

 
?>
